<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>FormLayout 表单布局</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />

    
    <script src="__PUBLIC__/scripts/boot.js" type="text/javascript"></script>
    
    
    <style type="text/css">
          
    .td1
    {
        text-align:right;
    }
    .td2
    {
        padding-left:15px;
        font-size:13px;
        font-family:Tahoma;
    }

    </style>

</head>
<body>
    <h1>新建项目</h1>      
  
<div id="form1">  

<fieldset> 
        <legend>项目基本信息</legend>
        <table>
            <tr>
                <td class="td1">
                    <label for="pno$text" >项目编号 </label>
                </td>
                <td >
                    <input class="mini-textbox"  required="true" id="pno" type="text" name="pno" value=""  />
                </td>       
            </tr>
              <tr>
                <td class="td1">
                    <label for="pname$text" >项目名称 </label>
                </td>
                <td >
                    <input class="mini-textbox"  required="true" id="pname" type="text" name="pname" value=""  />
                </td>
            </tr>
              <tr>
                <td class="td1">
                    <label for="date$text">入库时间 </label>
                </td>
                <td >
                    <input class="mini-datepicker" required="true" id="date" name="date" format="yyyy-MM-dd" />
                </td>
            </tr>
     </table> 
            
	
      </fieldset> 
     <fieldset> 
        <legend>项目组信息</legend> 
        
        <table>
            <tr>
                <td class="td1">
                   <label for="source">项目来源</label> 
                </td>
                <td >
                   <input  class="mini-textbox" id="source" type="text" name="source" value="" style="width:200px;" />
                </td>  
                <td class="td1">
                   <label for="prefund">拟投基金主体</label> 
                </td>
                <td >
                   <input name="prefund" showNullItem="true" class="mini-combobox" url="__APP__/Filter/fund" value="" textField="text" valueField="text" />
                </td>         
            </tr>
              <tr>
                <td class="td1">
                    <label for="partnername">合伙人</label> 
                </td>
                <td >
                    <input   class="mini-autocomplete" required="true" style="width:200px;"
    		valueField="text" textField="text" textName="partnername" name="partnername"
        url="__APP__/Filter/username"  > 
                </td>
                <td class="td1">
                   <label >项目经理</label> 
                </td>
                <td >
                 <input   class="mini-autocomplete" required="true" style="width:200px;"
    		valueField="text" textField="text" textName="managername" name="managername"
        url="__APP__/Filter/username"  >  
                 </td>       
            </tr>
              <tr>
                <td class="td1">
                   <label for="membername">项目组成员</label> 
                </td>
                <td >
				
				  
    <input id="lookup2" name="membername" class="mini-lookup" style="width:200px;" 
        textField="nickname" valueField="nickname" popupWidth="auto"
        popup="#gridPanel" grid="#datagrid1" multiSelect="true" />

                           
			  </td>
            </tr>
     </table>
     
        
           
    </fieldset> 
    <fieldset> 
        <legend>项目公司基本信息</legend> 
                <table>
            <tr>
                <td class="td1">
                   <label for="cname" >公司名称 </label>
                </td>
                <td >
                   <input class="mini-textbox" required="true" id="cname" type="text" name="cname" value=""  width="450px"/>
                </td>       
            </tr>
              <tr>
                <td class="td1">
                    <label for="address" >公司地址 </label> 
                </td>
                <td >
                   <input  class="mini-textbox" id="address" type="text" name="address" value="" width="450px" />
                </td>
            </tr>
              <tr>
                <td class="td1">
                   <label for="classify" >所属行业 </label> 
                </td>
                <td >
                   <input name="classify" showNullItem="true" class="mini-combobox" url="__APP__/Filter/industry" value="" textField="text" valueField="text" />
                  
                </td>
            </tr>
     </table>
      
    </fieldset> 

    <fieldset> 
        <legend>公司联系人信息</legend> 
          <div><label for="cpname" >姓名 </label> <input class="mini-textbox" required="true"  id="cpname" type="text" name="cpname" value=""  />
             </div> 
          <div><label for="cpposition" >职位 </label> <input class="mini-textbox"  required="true" id="cpposition" type="text" name="cpposition" value=""  />
             </div>
          <div><label for="cpphone" >电话 </label> <input class="mini-textbox"  required="true" onvalidation="onPhoneValidation" id="cpphone"  type="text" name="cpphone" value=""  />
             </div>
             <div><label for="cpemail" >邮箱 </label> <input class="mini-textbox"  required="true"  id="cpemail" type="text" name="cpemail" value=""  />
             </div>                  
    </fieldset> 
    
    <fieldset> 
        <legend>项目介绍</legend> 
            <div> 
                <label for="desc">描述  </label> 
                <textarea class="mini-textarea"  id="desc" name="desc" width="100%" ></textarea> 
            </div> 
           
    </fieldset> 
    
   
   	<br />
		<input value="提交" type="button" onclick="submitForm()" />
		
		
 </div>
 
 <div id="gridPanel" class="mini-panel" title="header" iconCls="icon-add" style="width:450px;height:250px;" 
        showToolbar="true" showCloseButton="true" showHeader="false" bodyStyle="padding:0" borderStyle="border:0" 
    >
        <div property="toolbar" style="padding:5px;padding-left:8px;text-align:center;">   
            <span>姓名：</span>    
            <input id="keyText" class="mini-textbox" style="width:160px;" onenter="onSearchClick"/>
            <a class="mini-button" onclick="onSearchClick">查询</a>
            <a class="mini-button" onclick="onCloseClick">关闭</a>
        </div>
        <div id="datagrid1" class="mini-datagrid" style="width:100%;height:100%;" 
            borderStyle="border:0" showPageSize="false" showPageIndex="false"
            url="__APP__/User/query"
        >
            <div property="columns">
                <div type="checkcolumn" >#</div>   
                <div field="nickname" width="120" headerAlign="center" allowSort="true">姓名</div>                     
            </div>
        </div>  
    </div>
    <script type="text/javascript">
        mini.parse();
		
        var grid = mini.get("datagrid1");
        var keyText = mini.get("keyText");
        grid.load();

         var t = mini.get("date");
         t.setValue(new Date());
         
		var issubmit=0;

        function submitForm() {
			//提交表单数据
            var form = new mini.Form("#form1");            
            var data = form.getData(true); 
			    form.validate();
            if (form.isValid() == false) return;
		//获取表单多个控件的数据
            //var json = mini.encode(data);   //序列化成JSON
            $.ajax({
                url: "__APP__/Project/add",
                type: "post",
                data: { Data: data },
                success: function (text) {
                    alert("提交成功");
                    issubmit=1;
                }
            });

        }
		
		 
	function getForm() {
			//提交表单数据
            var form = new mini.Form("#form1");  
            //form.validate();
            //if (form.isValid() == false) return;
			
            var data = form.getData(true);      //获取表单多个控件的数据
			
	   		var json = mini.encode(data);
			    //序列化成JSON
			mini.alert(json);
        }
		
		  function resetForm() {
            var form = new mini.Form("#form1");
            form.reset();
        }
      function onSearchClick(e) {
            grid.load({
                key: keyText.value
            });
        }
        function onCloseClick(e) {
            var lookup2 = mini.get("lookup2");
            lookup2.hidePopup();
        }
        function getData(){

		       if(issubmit==0)
            	return "尚未提交,";
            	else 
            	return "无变化";

       	}

 		function CloseWindow(action) {

        if (window.CloseOwnerWindow) window.CloseOwnerWindow(action);

        else window.close();

    	} 
		function onPhoneValidation(e){
            if (e.isValid) {
                if (isPhone(e.value) == false) {
                    e.errorText = "必须输入电话号码（数字或者下划线）";
                    e.isValid = false;
                }
            }
        }
        function isPhone(v) {
            var re = new RegExp("^[0-9\-]+$");
            if (re.test(v)) return true;
            return false;
        }
        
    </script>

    
</body>
</html>